﻿/*****************************************************************
 *@Copyright all rights reserved © 2014 Yuga
 *@author Oplink OMS
 *Contact: zengkang007@gmail.com
 *****************************************************************/
package com.oplink.webems.modules.sys.dao;

import java.util.List;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Component;

import com.oplink.webems.common.persistence.BaseDao;
import com.oplink.webems.common.persistence.BaseDaoImpl;
import com.oplink.webems.modules.sys.entity.Menu;

/**
 * 告警DAO接口
 * 
 * @author Oplink OMS
 * @version 2014-09-02
 */
public interface MenuDao extends MenuDaoCustom, CrudRepository<Menu, Long> {

	@Modifying
	@Query("update Menu set delFlag='" + Menu.DEL_FLAG_DELETE + "' where user.id = ?1")
	public int deleteById(Long id);

	@Override
	@Query("from Menu where delFlag='" + Menu.DEL_FLAG_NORMAL + "' ")
	public List<Menu> findAll();
}

/**
 * DAO自定义接口
 * 
 * @author Oplink OMS
 */
interface MenuDaoCustom extends BaseDao<Menu> {

}

/**
 * DAO自定义接口实现
 * 
 * @author Oplink OMS
 */
@Component
class MenuDaoImpl extends BaseDaoImpl<Menu> implements MenuDaoCustom {

}